loop = int(input())
for i in range(loop):
    for j in range(loop):
        if i == j:
            print(1, end=" ")
        else:
            print(0, end=" ")
    print()
